package com.ruitu.health_1.mvp.presenter;

import com.ruitu.arad.base.BasePresenter;
import com.ruitu.arad.util.ToastUtils;
import com.ruitu.health_1.mvp.model.OrderModel;
import com.ruitu.health_1.ui.ShippedActivity;
import com.ruitu.router_module.bean.BaseResult2;

import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import okhttp3.RequestBody;

public class ShippedPresenter {
    public static class ShippedP extends BasePresenter<ShippedActivity, OrderModel.OrderM> {
        public Disposable shipedd(RequestBody body) {
            return m.confirmReceipt(body)
                    .subscribe(new Consumer<BaseResult2>() {
                        @Override
                        public void accept(BaseResult2 baseResult2) throws Exception {
                            v.hideProgress();
                            if (baseResult2.isSuccess()) {
                                v.shippedSuc();
                            }
                            ToastUtils.showShort(baseResult2.getMessage());
                        }
                    }, new Consumer<Throwable>() {
                        @Override
                        public void accept(Throwable throwable) throws Exception {
                            v.hideProgress();
                        }
                    });
        }
    }
}
